package com.hmall.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hmall.item.pojo.Item;
import com.hmall.item.pojo.PageDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ItemMapper extends BaseMapper<Item> {

    @Select("update tb_item set stock=stock-#{num} where id =#{itemId}")
    void reduceGoodsFrequency(@Param("itemId") Long itemId,@Param("num") Integer num);


    //修改商品数量
    @Update("update tb_item set stock = #{stock} where id = #{id}")


    void updateItemNum(Long id, Integer stock);

}
